﻿using System;
using Commands.Settings;

namespace Commands.TorrentDownloaders
{
    internal class TapochekNetDownloadDispatcher : TokenDispatcherBase, ITokenDispatcher
    {
        public TapochekNetDownloadDispatcher(ServiceSettings settings) : base(settings)
        {

        }

        protected override Uri DispatcherLoginPage
        {
            get
            {
                return new Uri(@"http://tapochek.net/login.php");
            }
        }

        protected override string DOWNLOAD_LINK_REGEXP
        {
            get
            {
                        //http://tapochek.net/download.php?id=102305
                return "\"(?<download_link>download\\.php\\?id=\\d\\d+)\"";
            }
        }

        protected override string CHECK_TRACKER_REGEXP
        {
            get
            {
                return @"http\://tapochek\.net/viewtopic\.php\?t=\d+";
            }
        }

        protected override string FormatDownloadLink(string downloadLink)
        {
            return string.Format(@"http://tapochek.net/{0}", downloadLink);
        }
    }
}
